package me.zingon.MapDemo.job;

import me.zingon.MapDemo.service.BusLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * Created by ZTC on 3/24/2017.
 */
@Component
public class BusLineJob {
    @Autowired
    BusLineService busLineService;

    @PostConstruct
    public void getNewPos(){
        new Thread(new Runnable() {
            @Override
            public void run() {
                while(true) {
                    busLineService.getAllPos();
                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }

}
